package IO;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

public class ReaderFile {
    public static void main(String[] args) throws FileNotFoundException {
        try (Reader reader = new FileReader("d:/test.txt")){
            while (true) {
                int ch = reader.read();
                if(ch == -1) break;
                //汉字也是可以读取的
                System.out.println((char)ch);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
